cc.Class({
    extends: cc.Component,

    properties: {
        _pid:0,
        HeadIcon: cc.Sprite,
        HeadFrame: cc.Sprite,
        userid:{
            get(){return this._pid;},
            set(n){this._pid = n;},
        },

        nameLabel:cc.Label,
        goldLabel:cc.Label,
         gold: {
             get() { return this.goldLabel ? this.goldLabel.string : ''; },
             set(n) { this.goldLabel && (this.goldLabel.string = n) },
        },
        pname:{
            get() { return this.nameLabel ? this.nameLabel.string : ''; },
            set(n) { this.nameLabel && (this.nameLabel.string = n) },
        },

        scoreLabel: cc.Label,
        score: {
            get() { return this.scoreLabel ? this.scoreLabel.string : ''; },
            set(n) { this.scoreLabel && (this.scoreLabel.string = n) },
        },

        masterFlag: cc.Node,
        ismaster:{
            get() { return this.masterFlag && this.masterFlag.active; },
            set(n) { this.masterFlag && (this.masterFlag.active = n) },
        },
        
        zhuang: cc.Node,
        iszhuang: {
            get() { return this.zhuang && this.zhuang.active; },
            set(n) { this.zhuang && (this.zhuang.active = false) },
        },

        offlineFlag: cc.Node,
        isoffline: {
            get() { return this.offlineFlag && this.offlineFlag.active; },
            set(n) { this.offlineFlag && (this.offlineFlag.active = n) },
        },

        readyFlag: cc.Node,
        isready: {
            get() { return this.readyFlag && this.readyFlag.active; },
            set(n) { this.readyFlag && (this.readyFlag.active = n) },
        },
        
        // paoFlag: cc.Node,
        // paoLabel: cc.Label,
        // pao:{
        //     get() { return this.paoLabel ? this.paoLabel.string : '';},
        //     set(n){ 
        //         this.paoFlag && (this.paoFlag.active = n != 0);
        //         this.paoLabel && (this.paoLabel.string = n == 0 ? 0 : 0);
        //     }
        // },

     

        _seat: 0,
        seat:{
            get() { return this._seat; },
            set(n) { this._seat = n },
        },
        HeadSpriteAtlas: cc.SpriteAtlas,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },

    onLoad: function () {
        this.clear();

        let self = this;
        cc.loader.loadRes("Prefabs/PlayerInformation", function (err, prefab) {
            self.InfoLayer = prefab;
        });
    },

    clear(){
        this.userid = 0;
        this.pname = '虚位以待';
        this.ismaster = false;
        this.iszhuang =false;
        this.score = 0;
        this.isoffline = false;
        this.isready = false;
        this.headicon = '';
        this.location = '';
    },

    setHeadIcon(headicon) {
        this.headicon = headicon;
    },

    setHeadFrame(frame) {
        //this.HeadFrame.spriteFrame = this.HeadSpriteAtlas.getSpriteFrame('touxiangkuang_' + '' + frame);
       // this.headframe = frame;
    },

    // touchBegan(event) {
    //     let infoNode = cc.instantiate(this.InfoLayer);
    //     infoNode.parent = this.node.parent;
    //     infoNode.getComponent('playerInfoLogic').loadInfo({ name: this.userName, userid: this.userid, loaction: this.location, headicon: this.headicon });
    // },

    // update (dt) {},
});
